//警告：这是自动生成的代码，不要手动去修改.
//使用 wrapCLI 工具生成，工具版本为 <0.1.5>.

using System;
using System.Runtime.InteropServices;
public class Wrap {
    private const string dllFile = @"..\..\..\..\testCLib\out\Debug\testCLib.dll";
    public struct handle_void { public UInt64 ptr; }
//自定义类型 
    public enum wNum{
        w1 ,
        w2 = 100,
        w3 ,
    }
    public struct BigNum{
        public struct insideStc{
            public float aa;
            public int b;
        }
        public insideStc is0;
        public uint B1;
        public wNum wB;
        public handle_void B2;
        public insideStc is1;
    }
    public enum AddRessType{
        INT ,
        UINT ,
        FLOAT ,
    }
    unsafe delegate void stringAct(char* str);
    public delegate void stringAct_safe(string str);
    public struct handle_mesh { public UInt64 ptr; }
//函数 
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern void regStrAct(stringAct val);
    public static void regStrAct_safe(stringAct_safe val){
        unsafe { 
            stringAct _val = (str)=> { 
             string _str = new string(str);
                val(_str);
            };
            regStrAct(_val);
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
    unsafe static extern void pString(string val,byte* buf_arr);
    public static void pString_safe(string val,byte[] buf_arr){
        unsafe { 
            fixed (byte* _buf_arr = buf_arr) {
                pString(val ,_buf_arr);
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
    unsafe static extern char* retString(byte* buf_arr);
    public static string retString_safe(byte[] buf_arr){
        unsafe { 
            fixed (byte* _buf_arr = buf_arr) {
                var __retVal__ = retString(_buf_arr);
                return new string(__retVal__);
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern void pHVoid(handle_void val,byte* buf_arr);
    public static void pHVoid_safe(handle_void val,byte[] buf_arr){
        unsafe { 
            fixed (byte* _buf_arr = buf_arr) {
                pHVoid(val ,_buf_arr);
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern handle_void retHVoid(int* xxx_arr);
    public static handle_void retHVoid_safe(int[] xxx_arr){
        unsafe { 
            fixed (int* _xxx_arr = xxx_arr) {
                var __retVal__ = retHVoid(_xxx_arr);
                return __retVal__;
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern void pHStruct(handle_mesh val,byte* buf_arr);
    public static void pHStruct_safe(handle_mesh val,byte[] buf_arr){
        unsafe { 
            fixed (byte* _buf_arr = buf_arr) {
                pHStruct(val ,_buf_arr);
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    public static extern handle_mesh retHStruct();
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern void pSuffixOut(int* val_out);
    public static void pSuffixOut_safe(ref int val_out){
        unsafe { 
            fixed (int* _val_out = &val_out) {
                pSuffixOut(_val_out);
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern void pSuffixArr(int* val_arr,int arrLen,byte* buf_arr);
    public static void pSuffixArr_safe(int[] val_arr,int arrLen,byte[] buf_arr){
        unsafe { 
            fixed (int* _val_arr = val_arr) {
                fixed (byte* _buf_arr = buf_arr) {
                    pSuffixArr(_val_arr ,arrLen ,_buf_arr);
                }
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern void pSuffixHandle(handle_void val_handle,byte* buf_arr);
    public static void pSuffixHandle_safe(handle_void val_handle,byte[] buf_arr){
        unsafe { 
            fixed (byte* _buf_arr = buf_arr) {
                pSuffixHandle(val_handle ,_buf_arr);
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern float* retAliasArray(float* buf_arr,int bufLen,int* __retArrLen_out);
    public static float[] retAliasArray_safe(float[] buf_arr,int bufLen,ref int __retArrLen_out){
        unsafe { 
            fixed (float* _buf_arr = buf_arr) {
                fixed (int* ___retArrLen_out = &__retArrLen_out) {
                    var __retVal__ = retAliasArray(_buf_arr ,bufLen ,___retArrLen_out);
                    var @len = __retArrLen_out;
                    var @arr = new float[@len];
                    while (@len > 0) { @len--; @arr[@len] = __retVal__[@len]; }
                    return @arr;
                }
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    public static extern int testPDefVal(int a = 12,int b = 4);
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    public unsafe static extern int testPDefValComp(AddRessType a = AddRessType.INT,BigNum b = new BigNum(),int* c = null,int* d_arr = null,int* c_out = null);
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    public static extern float voidFun();
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    public static extern void printaddress(handle_void address,AddRessType _type);
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern float addNum(float a,float b,float* aa_out);
    public static float addNum_safe(float a,float b,ref float aa_out){
        unsafe { 
            fixed (float* _aa_out = &aa_out) {
                var __retVal__ = addNum(a ,b ,_aa_out);
                return __retVal__;
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern handle_void subNum(float a,float b,int* aa_out);
    public static handle_void subNum_safe(float a,float b,ref int aa_out){
        unsafe { 
            fixed (int* _aa_out = &aa_out) {
                var __retVal__ = subNum(a ,b ,_aa_out);
                return __retVal__;
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl)]
    unsafe static extern float mulNum(float a,float* b_arr,int arrSize);
    public static float mulNum_safe(float a,float[] b_arr,int arrSize){
        unsafe { 
            fixed (float* _b_arr = b_arr) {
                var __retVal__ = mulNum(a ,_b_arr ,arrSize);
                return __retVal__;
            }
        }
    }
    [DllImport(dllFile , CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
    unsafe static extern char* repeatStr(string str,byte* buf_arr);
    public static string repeatStr_safe(string str,byte[] buf_arr){
        unsafe { 
            fixed (byte* _buf_arr = buf_arr) {
                var __retVal__ = repeatStr(str ,_buf_arr);
                return new string(__retVal__);
            }
        }
    }
}
